﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Xml;

namespace Microsoft.MSE.Catalog.Contracts
{
    [ServiceContract(Namespace = SC.Namespace)]
    public interface IWCFCatalogSvc
    {

        [OperationContract]
        Guid GetIDFromName(string entityName, EntityClass entityClass);

        [OperationContract]
        ChannelList ListChannels();

        [OperationContract]
        Guid CreateChannel(Channel channel);

        [OperationContract]
        void DeleteChannel(Guid ID);

        [OperationContract]
        Channel UpdateChannel(Channel channel);

        [OperationContract]
        Channel GetChannel(Guid ID);

        [OperationContract]
        PolicyList ListPolicies();

        [OperationContract]
        Guid CreatePolicy(Policy policy);

        [OperationContract]
        void DeletePolicy(Guid ID);

        [OperationContract]
        Policy UpdatePolicy(Policy policy);

        [OperationContract]
        Policy GetPolicy(Guid ID);

        [OperationContract]
        RuntimeServerList ListRuntimeServers();

        [OperationContract]
        Guid CreateSchema(Schema schema);

        [OperationContract]
        Guid CreateRuntimeServer(RuntimeServer runtimeServer);

        [OperationContract]
        void DeleteRuntimeServer(Guid ID);

        [OperationContract]
        RuntimeServer UpdateRuntimeServer(RuntimeServer runtimeServer);

        [OperationContract]
        RuntimeServer GetRuntimeServer(Guid ID);

        [OperationContract]
        RuntimeServer GetRuntimeServerWithoutEndpointWSDL(Guid ID);

        [OperationContract]
        RuntimeServer GetRuntimeServerByName(string name);

        [OperationContract]
        EndpointList ListEndpoints();

        [OperationContract]
        EndpointList ListEndpointsForRuntimeServer(string runtimeServerName);

        [OperationContract]
        Guid CreateEndpoint(Endpoint endpoint);

        [OperationContract]
        void DeleteEndpoint(Guid ID);

        [OperationContract]
        Endpoint UpdateEndpoint(Endpoint endpoint);        

        [OperationContract]
        Endpoint GetEndpointWithoutWSDL(Guid ID);

        [OperationContract]
        Endpoint GetEndpoint(Guid ID, Guid runtimeServerID);

        [OperationContract]
        MSEBindingList ListMSEBindings();

        [OperationContract]
        Guid CreateMSEBinding(MSEBinding binding);

        [OperationContract]
        void DeleteMSEBinding(Guid ID);

        [OperationContract]
        MSEBinding UpdateMSEBinding(MSEBinding binding);

        [OperationContract]
        MSEBinding GetMSEBinding(Guid ID);

        [OperationContract]
        Guid ImportSchema(XmlElement schema, string preferredPrefix);

        [OperationContract]
        Schema GetSchema(Guid ID);

        [OperationContract]
        SchemaList ListSchemas();

        [OperationContract]
        Schema UpdateSchema(Schema schema);

        [OperationContract]
        void DeleteSchema(Guid ID);

        [OperationContract]
        List<OperationVersion> GetOperationVersionsForEndpointAndAction(Guid endpointID, string action);

        [OperationContract]
        List<OperationVersion> GetOperationVersionsForEndpointAndFirstBodyElement(Guid endpointID, string elementName, string namespaceURI);

        [OperationContract]
        Boolean ValidateOperationVersionRequest(XmlElement request, Guid opVersionID);

        [OperationContract]
        OperationList ListOperations();

        [OperationContract]
        OperationList ListOperationsBySchema(Guid schemaID);

        [OperationContract]
        Guid CreateOperation(Operation operation);

        [OperationContract]
        void DeleteOperation(Guid ID);

        [OperationContract]
        Guid CreateOperationVersion(OperationVersion operationVersion);

        [OperationContract]
        void DeleteOperationVersion(Guid ID);

        [OperationContract]
        Operation UpdateOperation(Operation operation);

        [OperationContract]
        OperationVersion UpdateOperationVersion(OperationVersion operationVersion);

        [OperationContract]
        Operation GetOperation(Guid ID);

        [OperationContract]
        OperationVersion GetOperationVersion(Guid ID);

        [OperationContract]
        void AssignAssociatedOperationVerToEndpoint(Guid operationVersionID, Guid endpointID);

        [OperationContract]
        void AssignPublishedOperationVerToEndpoint(Guid operationVersionID, Guid endpointID);

        [OperationContract]
        void RemoveAssociatedOperationVerForEndpoint(Guid operationVersionID, Guid endpointID);

        [OperationContract]
        void RemovePublishedOperationVerForEndpoint(Guid operationVersionID, Guid endpointID);


        [OperationContract]
        OperationGroup CreateOperationGroup(OperationGroup operationGroup);

        [OperationContract]
        OperationGroup GetOperationGroup(Guid ID);

        [OperationContract]
        OperationGroupList ListOperationGroups();

        [OperationContract]
        OperationGroupList ListOperationGroupsByOperation(Guid operationID);

        [OperationContract]
        void DeleteOperationGroup(Guid ID);

        [OperationContract]
        OperationGroup UpdateOperationGroup(OperationGroup operationGroup);

        [OperationContract]
        List<OperationListElement> ListOperationsByGroup(Guid ID);

        [OperationContract]
        void PublishRuntimeServerEndPointsToUddi(Guid ID, bool refresh);

        [OperationContract]
        void RemoveRuntimeServerEndPointsFromUddi(Guid ID);

        [OperationContract]
        bool IsUddiIntegrationEnabled();


        #region Eventing Operations

        [OperationContract(Action = "http://services.microsoft.com/2006-07/ServicePlatform/MSE6/Eventing/Subscribe")]
        SubscribeResponseMsg Subscribe(SubscribeRequestMsg request);

        [OperationContract(Action = "http://services.microsoft.com/2006-07/ServicePlatform/MSE6/Eventing/Renew")]
        RenewResponseMsg Renew(RenewRequestMsg request);

        [OperationContract(Action = "http://services.microsoft.com/2006-07/ServicePlatform/MSE6/Eventing/Unsubscribe")]
        void Unsubscribe(UnsubscribeRequestMsg request);

        [OperationContract(Action = "http://services.microsoft.com/2006-07/ServicePlatform/MSE6/Eventing/GetStatus")]
        GetStatusResponseMsg GetStatus(GetStatusRequestMsg request);

        #endregion

    }
}
